//
//  ViewController.m
//  UIscrollView2
//
//  Created by student on 16/2/29.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (nonatomic,weak) UIImageView *imgView;
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.jpg"]];
    [self.scrollView addSubview:image];
    
    self.scrollView.contentSize = image.bounds.size;
    self.imgView = image;
    self.scrollView.maximumZoomScale = 2;
    self.scrollView.minimumZoomScale = 0.2;
    self.scrollView.delegate = self;
}
- (nullable UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return self.imgView;
}


@end
